<template>
  <div class="">
    <el-button @click="testGet">GET请求</el-button>
    <el-button @click="testPost">POST请求</el-button>
    <el-button @click="testNoAuth">无权限测试</el-button>
    <el-button @click="testGetDynamicParams">GET动态路由</el-button>
    <el-button @click="testDownloadFile">下载</el-button>
    <input type="file" @change="testUploadFile">
  </div>
</template>
<script>
import { testGet, testNoAuth, testGetDynamicParams, testPost, testUploadFile, testDownloadFile } from '@/api/axios/index';

export default {
  name: '',
  components: {},
  data() {
    return {};
  },
  computed: {},
  created() {},
  mounted() {},
  methods: {
    async testGet() {
      const params = {
        name: '李四',
        age: 12
      };
      const { data } = await testGet(params);
      console.log(data);
    },
    async testNoAuth() {
      await testNoAuth();
    },
    async testGetDynamicParams() {
      const { data } = await testGetDynamicParams();
      console.log(data);
    },
    async testPost() {
      const params = {
        name: '周五',
        age: 14
      };
      const { data } = await testPost(params);
      console.log(data);
    },
    async testUploadFile(e) {
      const file = e.target.files[0];
      const params = {
        fileName: '1.jpg',
        file: file
      };
      const { data } = await testUploadFile(params);
      console.log(data);
    },
    async testDownloadFile() {
      await testDownloadFile();
    }
  }
};
</script>
<style lang="scss" scoped>
</style>
[]
